package com.star.book.controller.system;

import com.star.book.entity.LoginInfo;
import com.star.book.entity.User;
import com.star.book.service.ILoginInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.lang.annotation.Repeatable;
import java.util.List;
import java.util.Map;
/**
 * 用户登录日志记录
 * */
@Controller
public class SysUserLoginInfoController {
    @Autowired
    private ILoginInfoService loginInfoService;

    @GetMapping("/sys/loginInfo")
    public String loginInfo(Model m, @RequestParam Integer id){
        User user = SysUserInfo.loginInfo();
        m.addAttribute("user",user);
        Map<String, Object> stringObjectMap = loginInfoService.loginInfo(id);
        Integer page = (Integer)stringObjectMap.get("page");
        m.addAttribute("page",page);
        List<LoginInfo> loginUser = (List<LoginInfo>) stringObjectMap.get("loginUser");
        m.addAttribute("loginUser",loginUser);
        return "system/userLoginInfo";
    }
}
